package chixing.day08.homework;

public class Test9 {
    public static void main(String[] args) {
        Pet p1 =  new Dog();
        System.out.println(p1 instanceof Dog);
        System.out.println(p1 instanceof Pet);
        p1.run();

        Dog d1 = (Dog)p1;
        System.out.println(d1 instanceof Dog);
        System.out.println(d1 instanceof Pet);
        d1.run();

//        Pet p2 =  new Pet();
//        Dog d2 = (Dog)p2;
//        System.out.println(d2 instanceof Dog);
//        System.out.println(d2 instanceof Pet);
        Pet p2 =  new Pet();
        System.out.println(p2 instanceof Dog);
        System.out.println(p2 instanceof Pet);
        p2.run();
    }
}
